<?php
/**
 * author: JiangJun
 * CreateTime:2021/8/30 6:03 下午
 */

use Aws\Exception\AwsException;
use Aws\S3\Exception\S3Exception;
use Aws\S3\S3Client;

require '../sqs/vendor/autoload.php';

$s3Client = new S3Client([
    'region' => 'ap-northeast-2',
    'version' => '2006-03-01'
]);

// Gets the access control policy for a bucket
$bucket = 'jiang-bucket';
try {
    $resp = $s3Client->getBucketAcl([
        'Bucket' => $bucket
    ]);
    echo "Succeed in retrieving bucket ACL as follows: \n";
    var_dump($resp);
} catch (AwsException $e) {
    // output error message if fails
    echo $e->getMessage();
    echo "\n";
}